package com.nineclock.system.feign;

import com.nineclock.common.entity.Result;
import com.nineclock.system.dto.SysCompanyUserDTO;
import com.nineclock.system.dto.SysUserDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@FeignClient("sys-service") //配置服务名称
public interface SysUserFeign {

    /**
     * 根据用户名/手机号查询用户信息
     * @param username
     * @return
     */
    @GetMapping("/user/query")
    public Result<SysUserDTO> query(@RequestParam("username") String username);

    /**
     * 根据用户ID/企业ID查询员工信息
     * @param userId
     * @param companyId
     * @return
     */
    @GetMapping("/companyUser/query")
    public Result<List<SysCompanyUserDTO>> queryCompanyUser(@RequestParam(value = "userId", required = false) Long userId,
                                                            @RequestParam(value = "companyId", required = false)Long companyId) ;

    /**
     * 根据员工ID查询员工信息
     * @param companyUserId
     * @return
     */
    @GetMapping("/companyUser/query/{companyUserId}")
    public Result<SysCompanyUserDTO> queryByCompanyUserId(@PathVariable("companyUserId") Long companyUserId);


    /**
     * 查询企业所有员工
     * @return
     */
    @GetMapping("/companyUser/queryAllUser")
    public Result<List<SysCompanyUserDTO>> queryAllCompanyUser();


    /**
     * 查询当前企业的部门ID集合
     * @return
     */
    @GetMapping("/organization/department/top")
    public Result<List<Long>> queryDepartmentIds();

    /**
     * 查询指定部门下的员工数量
     * @param departmentIds
     * @return
     */
    @GetMapping("/organization/department/membernum")
    public Result<Integer> queryUserCountByDepartmentIds(@RequestParam("departmentIds") List<Long> departmentIds) ;

    /**
     * 根据员工id获得部门从低到高级别的部门ID集合
     * @param
     * @return
     */
    @GetMapping("/organization/allDepId/{companyUserId}")
    public Result<List<Long>> queryDepartmentsByUserId(@PathVariable("companyUserId") Long companyUserId);

    /**
     * 根据企业ID 查询主管理员
     * @param companyId
     * @return
     */
    @GetMapping("/companyUser/queryAdminByCompanyId")
    public Result<SysCompanyUserDTO> queryAdminByCompanyId(@RequestParam(value = "companyId") Long companyId);

    @PostMapping("/company/uploadOSS")
    public Result uploadFile(MultipartFile file);


}
